﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using IServices;
using Microsoft.AspNetCore.Mvc;
using YL.Core.Entity.Meter;

// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace WebApplication.Controllers.API
{
    [Route("api/[controller]")]
    [ApiController]
    public class CameraAPIController : ControllerBase
    {
        private readonly IMeter_CameraServices _cameraServices;

        public CameraAPIController(IMeter_CameraServices cameraServices) {
            _cameraServices = cameraServices;
        }

        // GET api/<CameraAPIController>/5
        [HttpGet]
        public List<Camera> Get()
        {
           return _cameraServices.QueryableToList(s=>s.IsDel==1);
        }

        // POST api/<CameraAPIController>
        [HttpPost]
        public Camera Post([FromBody] Camera camera)
        {
            return _cameraServices.InsertReturnEntity(camera);
        }

    }
}
